﻿<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Home</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="robots" content="all,follow">
    <!-- Bootstrap CSS-->
    <link rel="stylesheet" href="static/vendor/bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome CSS-->
    <link rel="stylesheet" href="static/vendor/font-awesome/css/font-awesome.min.css">
    <!-- Fontastic Custom icon font-->
    <link rel="stylesheet" href="static/css/fontastic.css">
    <!-- Google fonts - Poppins -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:300,400,700">
    <!-- theme stylesheet-->
    <link rel="stylesheet" href="static/css/style.default.css" id="theme-stylesheet">
    <!-- Custom stylesheet - for your changes-->
    <link rel="stylesheet" href="static/css/custom.css">
    <!-- Favicon-->
    <link rel="shortcut icon" href="static/img/favicon.ico">
    <!-- Tweaks for older IEs-->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]-->
</head>

<body>
    <div id="app">
        <div class="page">
            <!-- Main Navbar-->
            <header class="header">
                <nav class="navbar">
                    <!-- Search Box-->
                    <div class="search-box">
                        <button class="dismiss"><i class="icon-close"></i></button>
                        <form id="searchForm" action="#" role="search">
                            <input type="search" placeholder="What are you looking for..." class="form-control">
                        </form>
                    </div>
                    <div class="container-fluid">
                        <div class="navbar-holder d-flex align-items-center justify-content-between">
                            <!-- Navbar Header-->
                            <div class="navbar-header">
                                <!-- Navbar Brand -->
                                <a href="index.html" class="navbar-brand d-none d-sm-inline-block">
                                    <div class="brand-text d-none d-lg-inline-block"><span>淘书斋后台管理</span></div>
                            </div>
                            <!-- Navbar Menu -->
                            <ul class="nav-menu list-unstyled d-flex flex-md-row align-items-md-center">
                                <!-- Search-->
                                <li class="nav-item d-flex align-items-center">
                                    <a href="#"></a>
                                </li>


                                <!-- Logout    -->
                                <li class="nav-item">
                                    <li @click="logout()">
                                        <a href="" class="nav-link logout"> <span class="d-none d-sm-inline">退出</span><i class="fa fa-sign-out"></i></a>
                                    </li>



                                </li>
                            </ul>
                        </div>
                    </div>
                </nav>
            </header>
            <div class="page-content d-flex align-items-stretch">
                <!-- Side Navbar -->
                <nav class="side-navbar">
                    <!-- Sidebar Header-->
                    <div class="sidebar-header d-flex align-items-center">
                        <div class="avatar"><img src="static/img/gao.jpg" alt="..." class="img-fluid rounded-circle"></div>
                        <div class="title">
                            <h1 class="h4">{{adminName}}</h1>
                            <p>管理员</p>
                        </div>
                    </div>
                    <!-- Sidebar Navidation Menus--><span class="heading">管理</span>
                    <ul class="list-unstyled">
                        <li class="active">
                            <a href="index.html"> <i class="icon-home"></i>首页</a>
                        </li>
                        <li>
                            <a href="#bookDownDropdown" aria-expanded="false" data-toggle="collapse"> <i class="icon-interface-windows"></i>书本管理</a>
                            <ul id="bookDownDropdown" class="collapse list-unstyled ">
                                <li><a href="book.html">书本列表</a></li>
                                <li><a href="booktype.html">书本类型列表</a></li>
                            </ul>
                        </li>

                        <li>
                            <a href="#orderDownDropdown" aria-expanded="false" data-toggle="collapse"> <i class="icon-interface-windows"></i>订单管理</a>
                            <ul id="orderDownDropdown" class="collapse list-unstyled ">
                                <li><a href="order.html">订单列表</a></li>
                            </ul>
                        </li>

                        <li>
                            <a href="#userDownDropdown" aria-expanded="false" data-toggle="collapse"> <i class="icon-interface-windows"></i>用户管理</a>
                            <ul id="userDownDropdown" class="collapse list-unstyled ">
                                <li><a href="user.html">用户列表</a></li>
                                <li><a href="#">用户留言</a></li>
                            </ul>
                        </li>


                    </ul><span class="heading">设置</span>
                    <ul class="list-unstyled">
                        <li>
                            <a href="role.html"> <i class="icon-flask"></i>权限管理 </a>
                        </li>
                    </ul>
                </nav>
                <div id="cardhtml" class="content-inner">
                    <!-- Page Header-->
                    <header class="page-header">
                        <div class="container-fluid">
                            <h2 class="no-margin-bottom">淘书斋</h2>
                        </div>
                    </header>
                    <!-- Dashboard Counts Section-->
                    <section class="dashboard-counts no-padding-bottom">
                        <div class="container-fluid">
                            <div class="row bg-white has-shadow">
                                <!-- Item -->
                                <div class="col-xl-3 col-sm-6">
                                    <div class="item d-flex align-items-center">
                                        <div class="icon bg-violet"><i class="icon-user"></i></div>
                                        <div class="title"><span>用户数量</span>

                                        </div>
                                        <div class="number"><strong>10</strong></div>
                                    </div>
                                </div>

                                <div class="col-xl-3 col-sm-6">
                                    <div class="item d-flex align-items-center">
                                        <div class="icon bg-orange"><i class="icon-check"></i></div>
                                        <div class="title"><span>今日新增</span>

                                        </div>
                                        <div class="number"><strong>2</strong></div>
                                    </div>
                                </div>

                                <!-- Item -->
                                <div class="col-xl-3 col-sm-6">
                                    <div class="item d-flex align-items-center">
                                        <div class="icon bg-red"><i class="icon-padnote"></i></div>
                                        <div class="title"><span>今日订单</span>

                                        </div>
                                        <div class="number"><strong>70</strong></div>
                                    </div>
                                </div>
                                <!-- Item -->
                                <div class="col-xl-3 col-sm-6">
                                    <div class="item d-flex align-items-center">
                                        <div class="icon bg-green"><i class="icon-bill"></i></div>
                                        <div class="title"><span>今日利润</span>

                                        </div>
                                        <div class="number"><strong>￥666.6</strong></div>
                                    </div>
                                </div>
                                <!-- Item -->

                            </div>
                        </div>
                    </section>
                    <!-- Dashboard Header Section    -->
                    <section class="dashboard-header">
                        <div class="container-fluid">
                            <div class="row">
                                <!-- Statistics -->
                                <div class="statistics col-lg-3 col-12">
                                    <div class="statistic d-flex align-items-center bg-white has-shadow">
                                        <div class="icon bg-red"><i class="fa fa-tasks"></i></div>
                                        <div class="text"><strong>252</strong><br><small>本月销量</small></div>
                                    </div>
                                    <div class="statistic d-flex align-items-center bg-white has-shadow">
                                        <div class="icon bg-green"><i class="fa fa-calendar-o"></i></div>
                                        <div class="text"><strong>￥681</strong><br><small>本月利润</small></div>
                                    </div>
                                    <div class="statistic d-flex align-items-center bg-white has-shadow">
                                        <div class="icon bg-orange"><i class="fa fa-paper-plane-o"></i></div>
                                        <div class="text"><strong>3</strong><br><small>今日访问</small></div>
                                    </div>

                                </div>
                                <!-- Line Chart            -->
                                <div class="chart col-lg-6 col-12">
                                    <div class="bar-chart-example card">
                                        <div class="card-close">
                                            <div class="dropdown">
                                                <button type="button" id="closeCard6" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="dropdown-toggle"><i class="fa fa-ellipsis-v"></i></button>
                                                <div aria-labelledby="closeCard6" class="dropdown-menu dropdown-menu-right has-shadow">
                                                    <a href="#" class="dropdown-item remove"> <i class="fa fa-times"></i>Close</a>
                                                    <a href="#" class="dropdown-item edit"> <i class="fa fa-gear"></i>Edit</a>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="card-header d-flex align-items-center">
                                            <h3 class="h4">销售&利润分析</h3>
                                        </div>
                                        <div class="card-body">
                                            <canvas id="barChartExample"></canvas>
                                        </div>
                                    </div>
                                </div>
                                <div class="chart col-lg-3 col-12">
                                    <div class="line-chart-example card no-margin-bottom">
                                        <div class="card-close">
                                            <div class="dropdown">
                                                <button type="button" id="closeCard2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="dropdown-toggle"><i class="fa fa-ellipsis-v"></i></button>
                                                <div aria-labelledby="closeCard2" class="dropdown-menu dropdown-menu-right has-shadow">
                                                    <a href="#" class="dropdown-item remove"> <i class="fa fa-times"></i>Close</a>
                                                    <a href="#" class="dropdown-item edit"> <i class="fa fa-gear"></i>Edit</a>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="card-header d-flex align-items-center">
                                            <h3 class="h4">访问数量趋势</h3>
                                        </div>
                                        <div class="card-body">
                                            <canvas id="lineChartExample1"></canvas>
                                        </div>
                                    </div>
                                    <div class="line-chart-example card no-margin-bottom">
                                        <div class="card-close">
                                            <div class="dropdown">
                                                <button type="button" id="closeCard2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="dropdown-toggle"><i class="fa fa-ellipsis-v"></i></button>
                                                <div aria-labelledby="closeCard2" class="dropdown-menu dropdown-menu-right has-shadow">
                                                    <a href="#" class="dropdown-item remove"> <i class="fa fa-times"></i>Close</a>
                                                    <a href="#" class="dropdown-item edit"> <i class="fa fa-gear"></i>Edit</a>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="card-header d-flex align-items-center">
                                            <h3 class="h4">用户数量趋势</h3>
                                        </div>
                                        <div class="card-body">
                                            <canvas id="lineChartExample2"></canvas>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </section>


                    <!-- Page Footer-->
                    <footer class="main-footer">
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-6">
                                    <p class="weui-footer__text">Copyright © 2019 <a style="color:#3f8b81" href="#">抓娃小组</a>&nbsp版权所有</p>
                                </div>
                                <div class="col-sm-6 text-right">
                                    <p></p>
                                    <!-- Please do not remove the backlink to us unless you support further theme's development at https://bootstrapious.com/donate. It is part of the license conditions. Thank you for understanding :)-->
                                </div>
                            </div>
                        </div>
                    </footer>
                </div>
            </div>
        </div>
    </div>
    <!-- JavaScript files-->
    <script src="static/vendor/jquery/jquery.min.js"></script>
    <script src="static/vendor/popper.js/umd/popper.min.js">
    </script>
    <script src="static/vendor/bootstrap/js/bootstrap.min.js"></script>
    <script src="static/vendor/jquery.cookie/jquery.cookie.js">
    </script>
    <script src="static/vendor/chart.js/Chart.min.js"></script>
    <script src="static/vendor/jquery-validation/jquery.validate.min.js"></script>
    <script src="static/js/charts-home.js"></script>

    <!-- Main File-->
    <script src="static/js/front.js"></script>
    <script src="static/node_modules/vue/dist/vue.js"></script>



    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                //服务器:http://47.100.136.219
                serverIp: 'http://47.100.136.219',
                ifLocal: false,
                adminName: ''

            },

            mounted() {

                if (this.ifLocal) {
                    this.serverIp = "http://localhost";
                }
                let _this = this;
                $.ajax({
                    type: "GET",
                    url: _this.serverIp + ":8088/boot/admincommon/info",
                    success: function(response) {
                        if (response.code == 200) {
                            console.log(response.data);
                            _this.adminName = response.data.data.principal.username
                        }
                    },
                    error: function(response) {

                        $("#cardhtml").replaceWith('<div class="card-close"></div><div class="card-header d-flex align-items-center"><h3 class="h4">不好意思，您不是管理员，无权访问</h3></div>');


                    }
                });
                // ------------------------------------------------------- //
                // Charts Gradients
                // ------------------------------------------------------ //
                var ctx1 = $("canvas").get(0).getContext("2d");
                var gradient1 = ctx1.createLinearGradient(150, 0, 150, 300);
                gradient1.addColorStop(0, 'rgba(255, 119, 119, 0.91)');
                gradient1.addColorStop(1, 'rgba(255, 119, 119, 0.94)');

                var gradient2 = ctx1.createLinearGradient(146.000, 0.000, 154.000, 300.000);
                gradient2.addColorStop(0, 'rgba(104, 179, 112, 0.85)');
                gradient2.addColorStop(1, 'rgba(76, 162, 205, 0.85)');

                // ------------------------------------------------------- //
                // Line Chart 1
                // ------------------------------------------------------ //
                var LINECHART1 = $('#lineChartExample1');
                var myLineChart = new Chart(LINECHART1, {
                    type: 'line',
                    options: {
                        scales: {
                            xAxes: [{
                                display: true,
                                gridLines: {
                                    display: false
                                }
                            }],
                            yAxes: [{
                                ticks: {
                                    max: 40,
                                    min: 0,
                                    stepSize: 0.5
                                },
                                display: false,
                                gridLines: {
                                    display: false
                                }
                            }]
                        },
                        legend: {
                            display: false
                        }
                    },
                    data: {
                        labels: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
                        datasets: [{
                            label: "Total Overdue",
                            fill: true,
                            lineTension: 0,
                            backgroundColor: "transparent",
                            borderColor: '#6ccef0',
                            pointBorderColor: '#59c2e6',
                            pointHoverBackgroundColor: '#59c2e6',
                            borderCapStyle: 'butt',
                            borderDash: [],
                            borderDashOffset: 0.0,
                            borderJoinStyle: 'miter',
                            borderWidth: 3,
                            pointBackgroundColor: "#59c2e6",
                            pointBorderWidth: 0,
                            pointHoverRadius: 4,
                            pointHoverBorderColor: "#fff",
                            pointHoverBorderWidth: 0,
                            pointRadius: 4,
                            pointHitRadius: 0,
                            data: [20, 8, 30, 22, 24, 17, 20, 32, 28, 12, 33, 36],
                            spanGaps: false
                        }]
                    }
                });


                // ------------------------------------------------------- //
                // Line Chart 2
                // ------------------------------------------------------ //
                var LINECHART1 = $('#lineChartExample2');
                var myLineChart = new Chart(LINECHART1, {
                    type: 'line',
                    options: {
                        scales: {
                            xAxes: [{
                                display: true,
                                gridLines: {
                                    display: false,
                                    color: '#eee'
                                }
                            }],
                            yAxes: [{
                                ticks: {
                                    max: 40,
                                    min: 0,
                                    stepSize: 0.5
                                },
                                display: false,
                                gridLines: {
                                    display: false
                                }
                            }]
                        },
                        legend: {
                            display: false
                        }
                    },
                    data: {
                        labels: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
                        datasets: [{
                            label: "Total Overdue",
                            fill: true,
                            lineTension: 0,
                            backgroundColor: "transparent",
                            borderColor: '#ff7676',
                            pointBorderColor: '#ff7676',
                            pointHoverBackgroundColor: '#ff7676',
                            borderCapStyle: 'butt',
                            borderDash: [],
                            borderDashOffset: 0.0,
                            borderJoinStyle: 'miter',
                            borderWidth: 3,
                            pointBackgroundColor: "#ff7676",
                            pointBorderWidth: 0,
                            pointHoverRadius: 4,
                            pointHoverBorderColor: "#fff",
                            pointHoverBorderWidth: 0,
                            pointRadius: 4,
                            pointHitRadius: 0,
                            data: [3, 8, 12, 20, 18, 21, 19, 23, 17, 26, 28, 30],
                            spanGaps: false
                        }]
                    }
                });




                // ------------------------------------------------------- //
                // Bar Chart
                // ------------------------------------------------------ //
                var BARCHARTEXMPLE = $('#barChartExample');
                var barChartExample = new Chart(BARCHARTEXMPLE, {
                    type: 'bar',
                    options: {
                        scales: {
                            xAxes: [{
                                display: true,
                                gridLines: {
                                    color: '#eee'
                                }
                            }],
                            yAxes: [{
                                display: true,
                                gridLines: {
                                    color: '#eee'
                                }
                            }]
                        },
                    },
                    data: {
                        labels: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
                        datasets: [{
                            label: "销售",
                            backgroundColor: [
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1
                            ],
                            hoverBackgroundColor: [
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1
                            ],
                            borderColor: [
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1,
                                gradient1
                            ],
                            borderWidth: 1,
                            data: [302, 120, 280, 581, 356, 655, 620, 333, 622, 720, 833, 252],
                        }, {
                            label: "利润",
                            backgroundColor: [
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2
                            ],
                            hoverBackgroundColor: [
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2
                            ],
                            borderColor: [
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2,
                                gradient2
                            ],
                            borderWidth: 1,
                            data: [2662, 2820, 3360, 6947, 2888, 3227, 6630, 5522, 6830, 3322, 6252, 3286],
                        }]
                    }
                });

            },

            methods: {

                logout() {
                    let _this = this;
                    $.ajax({
                        url: _this.serverIp + ':8088/boot/logout',
                        type: 'POST',
                        success: function(res, status) {
                            console.log(res);
                            location.href = "login.html";

                        },
                        error: function(res, status) {
                            console.log(res);
                        }
                    });
                },


            },
        });
    </script>
</body>

</html>